$("#brand").change(function() {
	var id = $(this).val();
	$("#series").empty();
	if(id){
		$("#series").removeAttr("disabled");
		var option = document.createElement("option");
		option.text = "正在加载...";
		option.value = "";
		$("#series")[0].options.add(option);
		$.ajax({
			url : contextPath+"/getSeries/" + id,
			dataType : 'json',
			cache : false,
			success : function(result) {
				$("#series").empty();
				var empty = document.createElement("option");
				empty.text = "请选择车系";
				empty.value = "";
				$("#series")[0].options.add(empty);
				for ( var i in result) {
					var option = document.createElement("option");
					option.text = result[i].name;
					option.value = result[i].id;
					$("#series")[0].options.add(option);
				}
			},
			error:function(){
				$("#series").empty();
				var option = document.createElement("option");
				option.text = "加载失败";
				option.value = "";
				$("#series")[0].options.add(option);
			}
		});
	}
	else{
		var option = document.createElement("option");
		option.text = "请选择车系";
		option.value = "";
		$("#series")[0].options.add(option);
		//$("#series").attr("disabled","diabled");
	}
	//$("#brand").val($(this).find("option:selected").val()==''?'':$(this).find("option:selected").text().substring(2));
});
$(".brand-select").change(function() {
	var series = $(this).closest("li").find(".series-select");
	var id = $(this).val();
	series.empty();
	if(id){
		series.removeAttr("disabled");
		var option = document.createElement("option");
		option.text = "正在加载...";
		option.value = "";
		series[0].options.add(option);
		$.ajax({
			url : contextPath+"/getSeries/" + id,
			dataType : 'json',
			cache : false,
			success : function(result) {
				series.empty();
				var empty = document.createElement("option");
				empty.text = "请选择车系";
				empty.value = "";
				series[0].options.add(empty);
				for ( var i in result) {
					var option = document.createElement("option");
					option.text = result[i].name;
					option.value = result[i].id;
					series[0].options.add(option);
				}
			},
			error:function(){
				series.empty();
				var option = document.createElement("option");
				option.text = "加载失败";
				option.value = "";
				series[0].options.add(option);
			}
		});
	}
	else{
		var option = document.createElement("option");
		option.text = "请选择车系";
		option.value = "";
		series[0].options.add(option);
	}
});
$("#brand").change();
$(".brand-select").change();